<template>
  <div class="banner">
    <img :src="redirectUrl"
         alt=""
         v-if="imgState">
    <iframe v-else
            :src="redirectUrl"
            width="100%"
            height="100vh"></iframe>
  </div>
</template>
<script>
export default {
  name: 'banner',
  data () {
    return {
      redirectUrl: '',
      imgState: false
    };
  },
  mounted () {

  },
  created () {
    this.redirectUrl = this.$route.query.redirectUrl
    if (/.(png|jpg|jpeg|gif)$/g.test(this.redirectUrl)) {
      this.imgState = true
    } else {
      this.imgState = false
    }
  }
};
</script>
<style lang="less" scoped>
.banner {
  width: 100%;
  height: 100%;
  iframe {
    width: 100%;
    height: 100vh;
  }
  img {
    width: 100% !important;
  }
}
</style>